//
//  UIFont+MZCategory.h
//  MZToolkitDemo
//
//  Created by 沈家林 on 2017/11/1.
//  Copyright © 2017年 Chris Yang. All rights reserved.
//

#import <UIKit/UIKit.h>

#define MZFont(fontSize)        [UIFont mzDefaultFontWithSize:fontSize]

#define MZFontMoney48              ([UIFont mzFontWithFamily:@"DIN Alternate" Name:@"DINAlternate-Bold" size:48 weight:700])  //金额大字体
#define MZFontBold28               ([UIFont boldSystemFontOfSize:28])                                                         //28pt大标题
#define MZFontBold24               ([UIFont boldSystemFontOfSize:24])                                                         //24pt大标题
#define MZFontMedium24             ([UIFont mzMediumFontWithSize:24])                                                         //24pt大标题Medium
#define MZFontBold20               ([UIFont boldSystemFontOfSize:20])                                                         //20pt标题
#define MZFontRegular18            ([UIFont mzHelveticaFontWithSize:18])                                                      //18pt标题Regular
#define MZFontMedium18             ([UIFont mzMediumFontWithSize:18])                                                         //18pt标题Medium
#define MZFontMedium16             ([UIFont mzMediumFontWithSize:16])                                                         //16pt按钮Medium
#define MZFontRegular16            ([UIFont mzHelveticaFontWithSize:16])                                                      //16pt标题 Regular
#define MZFontRegular14            ([UIFont mzHelveticaFontWithSize:14])                                                      //14pt 描述文本
#define MZFontBold14               ([UIFont boldSystemFontOfSize:14])                                                         //14pt 正文本
#define MZFontRegular12            ([UIFont boldSystemFontOfSize:12])                                                         //12pt 描述文本


/* Adaptation
 * 大屏机型概念：iphone6及以上型号(即屏幕宽度>=375的机型）
 * 小屏机型概念：iphone5及以下型号(即屏幕宽度<375的机型)
 * 该模块以大屏幕手机为基础，针对小屏幕手机的字体信息进行变换处理
 */

#define mzAdaptiveFont(baseFontSize, reduceVal) \
[UIFont mzAdaptiveFontWithBaseSize:baseFontSize reduce:reduceVal]

@interface UIFont (MZCategory)

#pragma mark - Base

/* Setting */
+ (void)mzSetDefaultFontName:(NSString *)fontName;

/* Font Creater */
+ (UIFont *)mzDefaultFontWithSize:(CGFloat)fontSize;
+ (UIFont *)mzFontWithName:(NSString *)fontName size:(CGFloat)fontSize;
+ (UIFont *)mzFontWithFontAttributes:(NSDictionary<NSString *, id> *)attributes;//根据attributes生成字体

+ (UIFont *)mzMediumFontWithSize:(CGFloat)fontSize;//默认字体，字重500
+ (UIFont *)mzHelveticaFontWithSize:(CGFloat)fontSize;//Helvetica字体 字重400
+ (UIFont *)mzFontWithFamily:(NSString *)family Name:(NSString *)fontName size:(CGFloat)fontSize weight:(CGFloat)weightSize;

/* 字体遍历 */
+ (void)mzTraversalFontWithFontFamilyCallback:(void(^)(NSString *fontFamily))fontFamilyCallback
                             fontNameCallback:(void(^)(NSString *fontName))fontNameCallback;

/* 新字体添加说明 */
/* 1. 于Info.plist中添加【Fonts provided by application】字段，并设定对应的Item值为ttf文件名称
 * 2. 通过[字体遍历接口]找到对应的FontFamily或FontName即可使用了
 */

#pragma mark  字形适配手机

/* FontSize: 大屏手机标准字号
 * reduct: 小屏手机字号缩小幅度, 为负表示增大字号
 * fontName: 字体名称，如输入则为默认字体
 */
+ (UIFont *)mzAdaptiveFontWithBaseSize:(CGFloat)baseSize
                                reduce:(CGFloat)reduce;
+ (UIFont *)mzAdaptiveFontWithFontName:(NSString *)fontName
                              baseSize:(CGFloat)baseSize
                                reduce:(CGFloat)reduce;

@end
